package com.xcl.mapper;

import com.xcl.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.lang.annotation.Inherited;
import java.util.List;

@Mapper
public interface CategoryMapper {

    //查询所有
    @Select("select * from category")
    public List<Category> findAll();

    //删除
    @Delete("delete from category where id = #{id}")
    public Integer deleteById(Integer id);

    //添加
    @Insert("insert into category(category_name,category_alias,create_user,create_time,update_time)  " +
            "values (#{categoryName},#{categoryAlias},#{createUser},now(),now())")
    public Integer addCategory(Category category);

    //编辑数据
    @Update("update category set category_name = #{categoryName},category_alias = #{categoryAlias},create_user = #{createUser},update_time = now() where id = #{id}")
    public Integer update(Category category);

}
